<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
 */

Route::get('/', 'IndexController@index')->name('home')->description('控制台:首頁')->menu('控制台:首頁');
Route::get('timeline', 'IndexController@timeline')->name('timeline')->description('控制台:大紀事')->menu('控制台:大紀事');

// 其他
Route::post('upload', 'ImageController@upload')->name('image.upload')->description('其他:圖片上傳');
Route::get('example', 'IndexController@example')->name('example')->description('其他:例子');

// 後台用户管理
Route::namespace('Auth')->group(function () {

    Route::get('/login', 'AuthController@login')->name('admin.login')->description('基礎權限:登入');
    Route::post('/login', 'AuthController@auth')->name('admin.auth')->description('基礎權限:提交登入');
    Route::get('/logout', 'AuthController@logout')->name('admin.logout')->description('基礎權限:登出');

    Route::prefix('administrator')->group(function () {
        Route::get('/', 'AdministratorController@index')->name('admin.index')->description('後台用户:用户列表')->menu('後台用户:用户管理');
        Route::get('/create', 'AdministratorController@create')->name('admin.create')->description('後台用户:增加用户');
        Route::post('/store', 'AdministratorController@store')->name('admin.store')->description('後台用户:保存用户');
        Route::get('/edit/{id}', 'AdministratorController@edit')->name('admin.edit')->description('後台用户:編輯用户');
        Route::post('/edit', 'AdministratorController@update')->name('admin.update')->description('後台用户:更新用户');
        Route::any('/delete', 'AdministratorController@delete')->name('admin.delete')->description('後台用户:刪除用户');
        Route::get('/reset_password/{id}', 'AdministratorController@resetPassword')->name('admin.password.reset')->description('後台用户:重設密碼');
    });

    Route::prefix('permission')->group(function () {
        Route::get('/', 'PermissionController@index')->name('permission.index')->description('後台用户:權限列表')->menu('後台用户:權限管理');
        Route::get('/create', 'PermissionController@create')->name('permission.create')->description('後台用户:新增權限');
        Route::post('/store', 'PermissionController@store')->name('permission.store')->description('後台用户:保存權限');
        Route::get('/edit/{id}', 'PermissionController@edit')->name('permission.edit')->description('後台用户:編輯權限');
        Route::post('/edit', 'PermissionController@update')->name('permission.update')->description('後台用户:更新權限');
        Route::post('/delete', 'PermissionController@delete')->name('permission.delete')->description('後台用户:刪除權限');
    });

    Route::prefix('role')->group(function () {
        Route::get('/', 'RoleController@index')->name('role.index')->description('後台用户:角色列表')->menu('後台用户:角色管理');
        Route::get('/create', 'RoleController@create')->name('role.create')->description('後台用户:新增角色');
        Route::post('/store', 'RoleController@store')->name('role.store')->description('後台用户:保存角色');
        Route::get('/edit/{id}', 'RoleController@edit')->name('role.edit')->description('後台用户:編輯角色');
        Route::post('/edit', 'RoleController@update')->name('role.update')->description('後台用户:更新角色');
        Route::post('/delete', 'RoleController@delete')->name('role.delete')->description('後台用户:刪除角色');
        Route::get('/export', 'RoleController@export')->name('role.export')->description('後台用户:導出角色權限');
    });
});

// 操作日誌
Route::get('operation/log', 'OperationLogController@index')->name('operation.log')->description('後台用戶:操作日誌')->menu('後台用户:操作日誌');

// 個人設置
Route::prefix('profile')->group(function () {
    Route::get('/edit', 'ProfileController@edit')->name('profile.edit')->description('個人設置:修改資料');
    Route::post('/edit', 'ProfileController@update')->name('profile.update')->description('個人設置:保存資料');
    Route::get('/resetpassword', 'ProfileController@editPassword')->name('profile.password.edit')->description('個人設置:修改密碼');
    Route::post('/resetpassword', 'ProfileController@updatePassword')->name('profile.password.update')->description('個人設置:保存密碼');
});

// 參數設置-參數列表
Route::prefix('setting')->group(function () {
    Route::get('/', 'SettingController@index')->name('setting.index')->description('參數設置:參數列表')->menu('參數設置:參數列表');
    Route::get('/create', 'SettingController@create')->name('setting.create')->description('參數設置:新增參數');
    Route::post('/create', 'SettingController@store')->name('setting.store')->description('參數設置:保存參數');
    Route::get('/edit/{id}', 'SettingController@edit')->name('setting.edit')->description('參數設置:修改參數');
    Route::post('/edit', 'SettingController@update')->name('setting.update')->description('參數設置:更新參數');
    Route::any('/delete', 'SettingController@delete')->name('setting.delete')->description('參數設置:刪除參數');
});

Route::prefix('category')->group(function () {
    Route::get('/', 'ArticleCategoryController@index')->name('category.index')->description('内容管理:分类管理')->menu('内容管理:分类管理');
    Route::get('/create', 'ArticleCategoryController@create')->name('category.create')->description('内容管理:增加分类');
    Route::get('/edit/{id}', 'ArticleCategoryController@edit')->name('category.edit')->description('内容管理:編輯分类');
    Route::post('/update', 'ArticleCategoryController@store')->name('category.update')->description('内容管理:保存分类');
    Route::any('/delete', 'ArticleCategoryController@delete')->name('category.delete')->description('内容管理:刪除分类');
});

Route::prefix('article')->group(function () {
    Route::get('/', 'ArticleController@index')->name('article.index')->description('内容管理:文章管理')->menu('内容管理:文章管理');
    Route::get('/create', 'ArticleController@create')->name('article.create')->description('内容管理:增加文章');
    Route::get('/edit/{id}', 'ArticleController@edit')->name('article.edit')->description('内容管理:編輯文章');
    Route::post('/update', 'ArticleController@store')->name('article.update')->description('内容管理:保存文章');
    Route::any('/delete', 'ArticleController@delete')->name('article.delete')->description('内容管理:刪除文章');
});

Route::prefix('news')->group(function () {
    Route::get('/', 'NewsController@index')->name('news.index')->description('内容管理:新闻管理')->menu('内容管理:新闻管理');
    Route::get('/create', 'NewsController@create')->name('news.create')->description('内容管理:增加新闻');
    Route::get('/edit/{id}', 'NewsController@edit')->name('news.edit')->description('内容管理:編輯新闻');
    Route::post('/update', 'NewsController@store')->name('news.update')->description('内容管理:保存新闻');
    Route::any('/delete', 'NewsController@delete')->name('news.delete')->description('内容管理:刪除新闻');
});

Route::prefix('pages')->group(function () {
    Route::get('/', 'PagesController@index')->name('pages.index')->description('内容管理:单页管理')->menu('内容管理:单页管理');
    Route::get('/create', 'PagesController@create')->name('pages.create')->description('内容管理:增加单页');
    Route::get('/edit/{id}', 'PagesController@edit')->name('pages.edit')->description('内容管理:編輯单页');
    Route::post('/update', 'PagesController@store')->name('pages.update')->description('内容管理:保存单页');
    Route::any('/delete', 'PagesController@delete')->name('pages.delete')->description('内容管理:刪除单页');
});

Route::prefix('feedback')->group(function () {
    Route::get('/', 'FeedbackController@index')->name('feedback.index')->description('留言反馈:反馈管理')->menu('留言反馈:反馈管理');
});
